#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <kvs.h>
#define SAMPLE_CNT 5

char* keys[SAMPLE_CNT]={"bb","aa","yy","xx","zz"};
char* values[SAMPLE_CNT]={"bbbb","aaaa","yyyy","xxxx","zzzz"};

int main()
{
	char buf[1024];
	int i;
	KVS_SET kvs;

	kvs.init_type=KVS_CREATE;  // or KVS_LOAD if load kvs.
	kvs.size_in_g=1000;
	strcpy(kvs.disk_file, "/tmp/disk");
	strcpy(kvs.log, "/var/log/kvs.log");
//	strcpy(kvs.mem_log, "/var/log/kvs_mp.log");
	strcpy(kvs.disk_log, "/var/log/kvs_disk.log");
	strcpy(kvs.sync_log, "/var/log/kvs_sync.log");
	strcpy(kvs.index_log, "/var/log/kvs_index.log");
//	strcpy(kvs.bitmap, "bitmap");

	kv_init_2(&kvs);

	for (i=0; i<SAMPLE_CNT; i++)
	{
		kv_put( keys[i], strlen(keys[i]), values[i], strlen(values[i]) );
	}

	for (i=0; i<SAMPLE_CNT; i++) 
	{
		kv_get( keys[i], strlen(keys[i]), buf, 1024 );
		printf ("GET:%s  \t:\t%s\n",keys[i], buf);
	}

/*
	for (i=0; i<SAMPLE_CNT; i++)
	{
		kv_delete( keys[i], strlen(keys[i]));
	}
*/

	kv_exit();
	return 0;
}


